#include "MySqlRenameTableStatement.h"
#include "../../visitor/MySqlASTVisitor.h"
#include "../../../../ast/SQLName.h"
#include "../../../../../utils/listTran.h"

SQLName_ptr MySqlRenameTableStatement_Item::getName()
{
  return name;
}

void MySqlRenameTableStatement_Item::setName(SQLName_ptr name)
{
  this->name = name;
}

SQLName_ptr MySqlRenameTableStatement_Item::getTo()
{
  return to;
}

void MySqlRenameTableStatement_Item::setTo(SQLName_ptr to)
{
  this->to = to;
}

void MySqlRenameTableStatement_Item::accept0(MySqlASTVisitor_ptr visitor)
{
  if (visitor->visit(SharedObject(MySqlRenameTableStatement_Item)))
  {
    acceptChild(visitor, name);
    acceptChild(visitor, to);
  }
  visitor->endVisit(SharedObject(MySqlRenameTableStatement_Item));
}

std::shared_ptr<std::list<MySqlRenameTableStatement_Item_ptr>> MySqlRenameTableStatement::getItems()
{
  return items;
}

MySqlRenameTableStatement::MySqlRenameTableStatement()
{
  items = std::make_shared<std::list<MySqlRenameTableStatement_Item_ptr>>();
}

void MySqlRenameTableStatement::addItem(MySqlRenameTableStatement_Item_ptr item)
{
  if (item != NULL)
  {
    item->setParent(SharedObject(MySqlRenameTableStatement));
  }
  this->items->push_back(item);
}

void MySqlRenameTableStatement::accept0(MySqlASTVisitor_ptr visitor)
{
  if (visitor->visit(SharedObject(MySqlRenameTableStatement)))
  {
    SQLObject_list_ptr  tmp = ListTran::tran_class<MySqlRenameTableStatement_Item, SQLObject>(items);
    acceptChild(visitor, tmp);
  }
  visitor->endVisit(SharedObject(MySqlRenameTableStatement));
}
